#!/bin/sh

cd `dirname $0`

if [ ! -f test_C_02.c ]; then ln -s test_C_01.c test_C_02.c; fi
if [ ! -f test_C_03.c ]; then ln -s test_C_01.c test_C_03.c; fi
if [ ! -f test_C_13.c ]; then ln -s test_C_01.c test_C_13.c; fi
if [ ! -f test_C_14.c ]; then ln -s test_C_01.c test_C_14.c; fi

REMOVE_TEMPORARIES=1
export REMOVE_TEMPORARIES

os="`uname``uname -r`"
case x"$os" in
  xSunOS4*) CTEST="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18";;
  x*) CTEST="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19";;
esac

CPPTEST="01 02"

COMPILERS=`sed -e '/COMPILERS=/!d' -e 's,^COMPILERS=,,' ../Makefile`

for CC in $COMPILERS
do
  export CC

  for i in $CTEST
  do
    ./testone test_C_$i.c || exit 1
  done

  for i in $CPPTEST
  do
    ./testone test_C++_$i.cc || exit 1
  done
done
